#!/usr/bin/python
import curses
from mainmenu import MainMenu


def add_envir():
	screen.clear()
	screen.border(1)
	screen.addstr(1,1, "CommandLine : ")
	screen.refresh()

def get_param():
     input = screen.getstr(1, 15, 60)
     return input


screen = curses.initscr()

screen_height,screen_width = screen.getmaxyx()

screen.border(1)
screen.addstr(13, 30, "Welcome to the GIT!")
screen.refresh()
screen.getch()

#Doing try in case of crash, so the window is ended correctly
try:
	#Add the general interface
	add_envir()

	#context_win = curses.newwin(screen_width-5, screen_height-5, 3, 3)
	context_win = curses.newwin(screen_height - 5, screen_width - 6, 3, 4)

	#pass the context window
	main_menu = MainMenu(context_win)
	screen.refresh()
	
	#And we read input
	input_parm = get_param()
	while not(main_menu.selection(input_parm)):
	    input_parm = get_param()
finally:
	curses.endwin()
